﻿#ifndef _BASE_CHANNEL_
#define _BASE_CHANNEL_

namespace Channel {
namespace Listener {
class Interface {
public:
  virtual ~Interface() {}

  virtual void OnConnecting(const char* channelId) = 0;

  virtual void OnConnected(const char* channelId) = 0;

  virtual void OnDisconnected(const char* channelId, int error, const char* err_msg) = 0;
};

void Add(Interface* listener);

void Remove(Interface* listener);
}

namespace XcastEvent {
void OnConnecting(const char* channel_id);

void OnConnected(const char* channel_id);

void OnDisconnected(const char* channel_id, int error, const char* err_msg);
}

int Join(uint64_t app_id, uint64_t identifier, uint64_t channel_id, const char* auth, uint32_t len);

int Leave();

int SetSpearRole(const char* role);

const char* GetErrMsg();
}

#endif
